package day3

import scala.collection.mutable.ArrayBuffer

object Test4_tuple {
  def main(args: Array[String]): Unit = {
    //  目标：掌握元组的使用

    var tuple = ("very bitter",2,22.2,'s')
    println(tuple._1)
    println(tuple._2)
    println(tuple._3)

    // 元组只添加一个元素
    var tuple2 = Tuple1("再见很难")
    println(tuple2._1)

    var array = new ArrayBuffer[(String,Int,Double)]()
    array.append(("张三",22,99.9))
    array.append(("紫霞",25,89.9))
    array.append(("青霞",27,79.7))
    array.append(("王也",21,59.9))
    array.append(("何也",20,88.5))

    var sum = 0.0
    for (ele <- array) {
      sum += ele._3
    }
    println(sum / array.size)

  }
}
